import {createSlice} from "@reduxjs/toolkit"
import axios from "axios"
let lolslice = createSlice({
    name:"lol",
    initialState:{
        value:[]
    },
    reducers:{
        lolget:(state,action)=>{
            state.value = action.payload
        }
    }
})
let {lolget} = lolslice.actions
// 异步获取英雄数据
export  let asynclol = ()=>{
    return async (dispatch)=>{
    let {data} = await  axios({
            method:"get",
            url:"http://api.xiaohigh.com/lol"
        })
     let res = data.slice(0,73)
        dispatch(lolget(res)) 
   

    }
}
export default lolslice.reducer